<?php
date_default_timezone_set('Asia/Shanghai');
define('ROOT_PATH',    $_SERVER['DOCUMENT_ROOT'].'/');
//define("UPLOAD_DIR","/mnt/sdc1/data/");
//define('UPLOAD_HTTP', 'http://fs.81kaixuan.cn');
if (!empty($_FILES)) {
	$tle=isset($_GET['tle'])?(int)($_GET['tle']):0;
	$type=array('image/jpeg','image/gif','image/png');
	$inputName = $_FILES['pic']['name'] or die('无效input名称!');
	$size = getimagesize($_FILES['pic']['tmp_name']);//echo '<pre>';print_r($size);
	if($tle==0&&!in_array($size['mime'],$type)){exit(json_encode(array('state'=>0,'html'=>'请上传有效的图片格式')));}
	/* if($size[0]>360 || $size[1]>120){
		exit(json_encode(array('state'=>0,'info'=>'图片大小不能超过360*120')));
	} */
	//$this->loadHelper("uploader");
	include $_SERVER['DOCUMENT_ROOT']."/library/helper/uploader.php";
	$uploader = new uploader();
	$imgUrl = $uploader->start('pic');
	$logo = array('logo'=>$imgUrl,'state'=>1,'fileName'=>$inputName);
	exit(json_encode($logo));
}